#ifndef HPLCTIMEPROGRAMPAGE_H
#define HPLCTIMEPROGRAMPAGE_H

#include <QWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QLabel>
#include "tableviewex.h"
#include "hplctimeprogram.h"

class HplcTimeProgramPage : public QWidget
{
    Q_OBJECT
public:
    explicit HplcTimeProgramPage(QWidget *parent = nullptr);
    ~HplcTimeProgramPage();

    TimeProgramUnit getTableRow(int row);
    QList<TimeProgramUnit> getTable();

    static QString zero2String(bool isZero);
    static bool string2Zero(QString str);
    static QString range2String(quint8 range);
    static quint8 string2Range(QString str);

signals:

public slots:
    void onShowGradientCurve();

private:
    TableViewEx         *m_tableView;
    QLabel              *m_lbLoopTimes;
    QLineEdit           *m_leLoopTimes; // 循环次数
    QLabel              *m_lbSampleTime;
    QLineEdit           *m_leSampleTime; // 采集时间 min
    QLabel              *m_lbTotalRunTime;
    QLineEdit           *m_leTotalRunTime; // 总运行时间 min
    QCheckBox           *m_ckbUsedTimeProgram;
    QPushButton         *m_pbStopAllPumps;
    QPushButton         *m_pbInjectProgram;
    QPushButton         *m_pbGradientCurve;

    QPushButton         *m_pbTest;
    QPushButton         *m_pbRun;
    QPushButton         *m_pbRunFirstRow;
    QPushButton         *m_pbRunBasicParam;
    QPushButton         *m_pbPauseRestore;
    QPushButton         *m_pbStop;

    QLabel              *m_lbCurrent;
    QLabel              *m_lbStatus;
    QLabel              *m_lbCurrentRow;
    QLabel              *m_lbCurrentPumpAFlow;
    QLabel              *m_lbCurrentPumpBFlow;
    QLabel              *m_lbCurrentPumpCFlow;
    QLabel              *m_lbCurrentPumpDFlow;

    QStringList         m_rangeList;
    QStringList         m_isZeroList;

    int                 m_loopTimes;
    double              m_sampleTime;
    double              m_totalRunTime;
    bool                m_isUsedTimeProgram;
};

#endif // HPLCTIMEPROGRAMPAGE_H
